/*     */ package btsQuery;
/*     */ 
/*     */ import btsm.bean.sqlBTSWork;
/*     */ import java.io.IOException;
/*     */ import java.io.PrintStream;
/*     */ import java.io.PrintWriter;
/*     */ import java.sql.ResultSet;
/*     */ import javax.servlet.ServletException;
/*     */ import javax.servlet.http.HttpServlet;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ 
/*     */ public class btsQueryByNameServlet extends HttpServlet
/*     */ {
/*     */   protected void processRequest(HttpServletRequest request, HttpServletResponse response)
/*     */     throws ServletException, IOException
/*     */   {
/*     */     try
/*     */     {
/*  40 */       String strBTSFilter = request.getParameter("strBTSName");
/*  41 */       sqlBTSWork oBGQuery = new sqlBTSWork("", "0");
/*     */ 
/*  44 */       ResultSet result = oBGQuery.oGTBQuery(strBTSFilter);
/*     */ 
/*  47 */       StringBuffer results = new StringBuffer("<properties>");
/*     */ 
/*  52 */       while (result.next()) {
/*  53 */         String strbtsCode = result.getString("btscode");
/*  54 */         String strbtsName = result.getString("btsname");
/*  55 */         String strbtszone = result.getString("btszone");
/*  56 */         String strlandform = result.getString("landform");
/*  57 */         String strbtsLat = result.getString("lat");
/*  58 */         String strbtsLng = result.getString("lng");
/*  59 */         String strRoad = result.getString("road");
/*  60 */         String strbtslevel = result.getString("btslevel");
/*  61 */         String strWRadius = result.getString("workingradius");
/*  62 */         String strDistanceC = result.getString("distanceC");
/*  63 */         String strarrivaltimeC = result.getString("arrivaltimeC");
/*  64 */         String strDistanceP = result.getString("distanceP");
/*  65 */         String strarrivaltimeP = result.getString("arrivaltimeP");
/*  66 */         if ((strRoad == null) || (strRoad.equals("")))
/*  67 */           strRoad = "未知";
/*  68 */         if (strWRadius == null) {
/*  69 */           strWRadius = "30";
/*     */         }
/*  71 */         System.out.println("strRoad:" + strRoad);
/*     */ 
/*  74 */         results.append("<property>");
/*  75 */         results.append("<btsCode>");
/*  76 */         results.append(strbtsCode);
/*  77 */         results.append("</btsCode>");
/*  78 */         results.append("<btsName>");
/*  79 */         results.append(strbtsName);
/*  80 */         results.append("</btsName>");
/*  81 */         results.append("<btszone>");
/*  82 */         results.append(strbtszone);
/*  83 */         results.append("</btszone>");
/*  84 */         results.append("<landform>");
/*  85 */         results.append(strlandform);
/*  86 */         results.append("</landform>");
/*  87 */         results.append("<btsLat>");
/*  88 */         results.append(strbtsLat);
/*  89 */         results.append("</btsLat>");
/*  90 */         results.append("<btsLng>");
/*  91 */         results.append(strbtsLng);
/*  92 */         results.append("</btsLng>");
/*  93 */         results.append("<btsLevel>");
/*  94 */         results.append(strbtslevel);
/*  95 */         results.append("</btsLevel>");
/*  96 */         results.append("<wRadius>");
/*  97 */         results.append(strWRadius);
/*  98 */         results.append("</wRadius>");
/*  99 */         results.append("<btsRoad>");
/* 100 */         results.append(strRoad);
/* 101 */         results.append("</btsRoad>");
/* 102 */         results.append("<distanceC>");
/* 103 */         results.append(strDistanceC);
/* 104 */         results.append("</distanceC>");
/* 105 */         results.append("<arrivaltimeC>");
/* 106 */         results.append(strarrivaltimeC);
/* 107 */         results.append("</arrivaltimeC>");
/* 108 */         results.append("<distanceP>");
/* 109 */         results.append(strDistanceP);
/* 110 */         results.append("</distanceP>");
/* 111 */         results.append("<arrivaltimeP>");
/* 112 */         results.append(strarrivaltimeP);
/* 113 */         results.append("</arrivaltimeP>");
/* 114 */         results.append("</property>");
/*     */       }
/*     */ 
/* 118 */       results.append("</properties>");
/* 119 */       response.setContentType("text/xml;charset=UTF-8");
/*     */ 
/* 121 */       response.getWriter().write(results.toString());
/* 122 */       result.close();
/*     */     }
/*     */     catch (ClassNotFoundException e) {
/* 125 */       System.err.print("ClassNotFoundException: ");
/*     */ 
/* 127 */       System.err.println(e.getMessage());
/*     */     }
/*     */     catch (Exception localException)
/*     */     {
/*     */     }
/*     */   }
/*     */ 
/*     */   protected void doGet(HttpServletRequest request, HttpServletResponse response)
/*     */     throws ServletException, IOException
/*     */   {
/* 147 */     processRequest(request, response);
/*     */   }
/*     */ 
/*     */   protected void doPost(HttpServletRequest request, HttpServletResponse response)
/*     */     throws ServletException, IOException
/*     */   {
/* 157 */     processRequest(request, response);
/*     */   }
/*     */ 
/*     */   public String getServletInfo()
/*     */   {
/* 164 */     return "Short description";
/*     */   }
/*     */ }

/* Location:           E:\java\apache-tomcat-6.0.36\webapps\btsm\WEB-INF\classes\
 * Qualified Name:     btsQuery.btsQueryByNameServlet
 * JD-Core Version:    0.6.2
 */